package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

public class Test5 {
    public static void main(String[] args) throws Exception {
        Class c=Person.class;
        Method[]methods=c.getDeclaredMethods();
        Object obj=c.newInstance();
        for (Method m:methods){
            if (m.isAnnotationPresent(AutoRunMethod.class)){
                AutoRunMethod ar=m.getAnnotation(AutoRunMethod.class);
                for (int i = 0; i <ar.times() ; i++) {
                    m.invoke(obj);
                }
            }
        }
    }
}
